package com.intermancer.predictor.store;

import com.intermancer.predictor.organism.Organism;

public class StoreEntry {
	
	private double score;
	private Long identity;
	private Organism organism;
	
	public StoreEntry() {
		// Nothing
	}

	public StoreEntry(double score, Long identity, Organism organism) {
		super();
		setScore(score);
		setIdentity(identity);
		setOrganism(organism);
	}
	
	public StoreEntry(StoreEntry other) {
		this(other.getScore(), other.getIdentity(), other.getOrganism());
	}

	public double getScore() {
		return score;
	}
	
	public void setScore(double score) {
		this.score = score;
	}
	
	public Long getIdentity() {
		return identity;
	}
	
	public void setIdentity(Long identity) {
		this.identity = identity;
	}
	
	public Organism getOrganism() {
		return organism;
	}
	
	public void setOrganism(Organism organism) {
		this.organism = organism;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof StoreEntry) {
			StoreEntry other = (StoreEntry) obj;
			return (identity.equals(other.identity))
					&& (score == other.score)
					&& (this.organism.equals(other.organism));
		}
		return false;
	}

	@Override
	public int hashCode() {
		int hashCode = (int) score;
		hashCode += identity;
		hashCode += organism.hashCode();
		return super.hashCode();
	}

}
